package jmine.tec.hydra.web.pages.especificacao.agendamento;

import jmine.tec.hydra.web.pages.especificacao.agendamento.ConsultaIntegracaoEspecificacaoAgendamento.HydraScheduledSpecificationRowData;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;

/**
 * Panel que exibe o detalhe de um {@link HydraScheduledSpecificationRowData} de Agendamento.
 * 
 * @author Renan Kuroki
 * @created 06/01/2011
 * @deprecated use jmine.tec.scheduling
 */
@Deprecated
public class ModalPanelDetalheEspecificacaoAgendamento extends Panel {

    private HydraScheduledSpecificationRowData scheduledSpecRowData;

    /**
     * Construtor
     * 
     * @param id id do componente ModalWindow
     * @param specRowData {@link HydraScheduledSpecificationRowData}
     */
    public ModalPanelDetalheEspecificacaoAgendamento(String id, HydraScheduledSpecificationRowData specRowData) {
        super(id);
        this.scheduledSpecRowData = specRowData;
        this.generateComponents();
    }

    /**
     * Gera os componentes utilizados pelo modal panelz
     */
    private void generateComponents() {
        this.add(new Label("sistema", new PropertyModel<String>(this.scheduledSpecRowData, "scheduledSpecification.system")));
        this.add(new Label("acao", new PropertyModel<String>(this.scheduledSpecRowData, "scheduledSpecification.action")));
        this.add(new Label("status", new PropertyModel<String>(this.scheduledSpecRowData, "status")));
        this.add(new Label("emissor", new PropertyModel<String>(this.scheduledSpecRowData, "emissor")));
        this.add(new Label("descricaoEmissor", new PropertyModel<String>(this.scheduledSpecRowData, "descricaoEmissor")));

        WebMarkupContainer containerCodificacao = new WebMarkupContainer("containerCodificacao");
        containerCodificacao.add(new Label("codificacao", new PropertyModel<String>(this.scheduledSpecRowData,
                "scheduledSpecification.encodeScript.mnemonico")));
        containerCodificacao.add(new TextArea<String>("detalheCodificacao", new PropertyModel<String>(this.scheduledSpecRowData,
                "scheduledSpecification.encodeScript.body")));
        if (this.scheduledSpecRowData.getScheduledSpecification().getEncodeScript() == null) {
            containerCodificacao.setVisible(false);
        }
        this.add(containerCodificacao);

        WebMarkupContainer containerModelo = new WebMarkupContainer("containerModelo");
        containerModelo.add(new Label("modelo", new PropertyModel<String>(this.scheduledSpecRowData,
                "scheduledSpecification.template.mnemonico")));
        containerModelo.add(new TextArea<String>("detalheModelo", new PropertyModel<String>(this.scheduledSpecRowData,
                "scheduledSpecification.template.body")));
        if (this.scheduledSpecRowData.getScheduledSpecification().getTemplate() == null) {
            containerModelo.setVisible(false);
        }
        this.add(containerModelo);
    }

    /**
     * @return the scheduledSpecRowData
     */
    public HydraScheduledSpecificationRowData getScheduledSpecRowData() {
        return this.scheduledSpecRowData;
    }

}